package conf

import (
	"sync/atomic"
	"time"
)

var serverAgentReadRemoteTimeout = new(atomic.Value)
var serverAgentWriteRemoteTimeout = new(atomic.Value)
var serverAgentDialLocalTimeout = new(atomic.Value)
var serverAgentReadLocalTimeout = new(atomic.Value)
var serverAgentWriteLocalTimeout = new(atomic.Value)
var serverAgentRequestMaxWaitingTime = new(atomic.Value)

var ServerAgentRequestBacklog int

//lark server
var ServerAgentReadRemoteTimeout = func() time.Duration {
	return serverAgentReadRemoteTimeout.Load().(time.Duration)
}

func SetServerAgentReadRemoteTimeout(d time.Duration) {
	serverAgentReadRemoteTimeout.Store(d)
}

//
var ServerAgentWriteRemoteTimeout = func() time.Duration {
	return serverAgentWriteRemoteTimeout.Load().(time.Duration)
}

func SetServerAgentWriteRemoteTimeout(d time.Duration) {
	serverAgentWriteRemoteTimeout.Store(d)
}

//
var ServerAgentDialLocalTimeout = func() time.Duration {
	return serverAgentDialLocalTimeout.Load().(time.Duration)
}

func SetServerAgentDialLocalTimeout(d time.Duration) {
	serverAgentDialLocalTimeout.Store(d)
}

//
var ServerAgentReadLocalTimeout = func() time.Duration {
	return serverAgentReadLocalTimeout.Load().(time.Duration)
}

func SetServerAgentReadLocalTimeout(d time.Duration) {
	serverAgentReadLocalTimeout.Store(d)
}

var ServerAgentWriteLocalTimeout = func() time.Duration {
	return serverAgentWriteLocalTimeout.Load().(time.Duration)
}

func SetServerAgentWriteLocalTimeout(d time.Duration) {
	serverAgentWriteLocalTimeout.Store(d)
}

func ServerAgentRequestMaxWaitingTime() time.Duration {
	return serverAgentRequestMaxWaitingTime.Load().(time.Duration)
}

func SetServerAgentRequestMaxWaitingTime(d time.Duration) {
	serverAgentRequestMaxWaitingTime.Store(d)
}
